home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / LinAlg 3.1 / LinAlg / vvector.dat < prev    next >
Encoding:
Text File  |  1995-12-21  |  4.8 KB  |  165 lines  |  [TEXT/CWIE]

  1.  
  2.  
  3. -------------------------------------------------------------------------------
  4.         Verify Operations on Vectors
  5.  
  6.  
  7. ---> Test allocation and compatibility check
  8. The following vector have been allocated
  9.  
  10. Matrix 1:20x1:1 ''
  11. Matrix 1:20x1:1 ''
  12. Matrix 0:19x1:1 ''
  13. Matrix 1:20x1:1 ''
  14. Status information reported for vector v3:
  15.   Lower bound ... 0
  16.   Upper bound ... 19
  17.   No. of elements 20
  18.   Name 
  19.  
  20. Check vectors 1 & 2 for compatibility
  21. Check vectors 1 & 4 for compatibility
  22. v2 has to be compatible with v3 after resizing to v3
  23. v1 has to be compatible with v5 after resizing to v5.upb
  24.  
  25. Matrix 1:25x1:1 'Vector v5'
  26. Check that shrinking does not change remaining elements
  27. Check that expansion expands by zeros
  28.  
  29. Done
  30.  
  31.  
  32. ---> Test operations that treat each element uniformly
  33. Writing zeros to v...
  34. Clearing v1 ...
  35. Comparing v1 with 0 ...
  36. Writing a pattern 3.14159 by assigning to v(i)...
  37. Writing the pattern by assigning to v1 as a whole ...
  38. Comparing v and v1 ...
  39. Comparing (v=0) and v1 ...
  40.  
  41. Clear v and add the pattern
  42.    add the doubled pattern with the negative sign
  43. Element (18,1) with value -3.14159 differs the most from what
  44. was expected, -3.14159, though the deviation 2.38419e-07 is small
  45.    subtract the trippled pattern with the negative sign
  46.  
  47. Verify comparison operations
  48.  
  49. Assign 2*pattern to v by repeating additions
  50. Assign 2*pattern to v1 by multiplying by two 
  51. Multiply v1 by one half returning it to the 1*pattern
  52.  
  53. Assign -pattern to v and v1
  54. v = sqrt(sqr(v)); v1 = abs(v1); Now v and v1 have to be the same
  55. Element (18,1) with value 9.86961 differs the most from what
  56. was expected, 9.8696, though the deviation 9.53674e-07 is small
  57.  
  58. Check out to see that sin^2(x) + cos^2(x) = 1
  59. Element (17,1) with value 1 differs the most from what
  60. was expected, 1, though the deviation 2.38419e-07 is small
  61.  
  62.     do it again through LazyMatrix promise of a vector
  63. Element (17,1) with value 1 differs the most from what
  64. was expected, 1, though the deviation 2.38419e-07 is small
  65. Element (17,1) with value 1 differs the most from what
  66. was expected, 1, though the deviation 2.38419e-07 is small
  67.  
  68. Verify constructor with initialization
  69.  
  70. Done
  71.  
  72.  
  73. ---> Test Binary Vector operations
  74.  
  75. Verify assignment of a vector to the vector
  76.  
  77. Adding one vector to itself, uniform pattern 3.14159
  78.   subtracting two vectors ...
  79.   subtracting the vector from itself
  80.   adding two vectors together
  81.  
  82. Arithmetic operations on vectors with not the same elements
  83.    adding vp to the zero vector...
  84.    making v = 3*vp and v1 = 3*vp, via add() and succesive mult
  85.    clear both v and v1, by subtracting from itself and via add()
  86. Two (19,1) elements of matrices with values -3.8147e-06 and 0
  87. differ the most, though the deviation 3.8147e-06 is small
  88.  
  89. Testing element-by-element multiplications and divisions
  90.    squaring each element with sqr() and via multiplication
  91.    compare (v = pattern^2)/pattern with pattern
  92.  
  93.  
  94. Comparison of two Matrices:
  95.     Original vector and vector after squaring and dividing
  96. Matrix 2:21x1:1 ''
  97. Matrix 2:21x1:1 ''
  98. Maximal discrepancy         0
  99.    occured at the point     (2,1)
  100.  Matrix 1 element is            3.14159
  101.  Matrix 2 element is            3.14159
  102.  Absolute error v2[i]-v1[i]     0
  103.  Relative error             0
  104.  
  105. ||Matrix 1||            62.8319
  106. ||Matrix 2||            62.8319
  107. ||Matrix1-Matrix2||             0
  108. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   0
  109.  
  110.  
  111. Done
  112.  
  113. ---> Verify norm calculations
  114.  
  115. Assign 10.25 to all the elements and check norms
  116.   1. norm should be pattern*no_elems
  117.   Square of the 2. norm has got to be pattern^2 * no_elems
  118.   Inf norm should be pattern itself
  119.   Scalar product of vector by itself is the sqr(2. vector norm)
  120.  
  121. Assign the arithm progression with 1. term -10.25
  122. and the difference 1
  123.   1. norm should be 100.5
  124.   Square of the 2. norm has got to be n*[ a0^2 + a0*q*(n-1) + q^2/6*(n-1)*(2n-1) ], or 676.25
  125.   Inf norm should be max(abs(a0),abs(a0+(n-1)*q)), ie 10.25
  126.   Scalar product of vector by itself is the sqr(2. vector norm)
  127.  
  128.  
  129. Comparison of two Matrices:
  130.     Compare the vector v with a zero vector
  131. Matrix 1:20x1:1 ''
  132. Matrix 1:20x1:1 ''
  133. Maximal discrepancy         10.25
  134.    occured at the point     (1,1)
  135.  Matrix 1 element is            -10.25
  136.  Matrix 2 element is            0
  137.  Absolute error v2[i]-v1[i]     10.25
  138.  Relative error             2
  139.  
  140. ||Matrix 1||            100.5
  141. ||Matrix 2||            0
  142. ||Matrix1-Matrix2||             100.5
  143. ||Matrix1-Matrix2||/sqrt(||Matrix1|| ||Matrix2||)   1.005e+09
  144.  
  145.  
  146. Construct v1 to be orthogonal to v as v(n), -v(n-1), v(n-2)...
  147. ||v1|| has got to be equal ||v|| regardless of the norm def
  148. But the scalar product has to be zero
  149.  
  150. Done
  151.  
  152.  
  153. ---> Test operations with vectors and matrix slices
  154.  
  155. Check modifying the matrix column-by-column
  156.  
  157. Check modifying the matrix row-by-row
  158.  
  159. Check modifying the matrix diagonal
  160.  
  161. Check out to see that multiplying by diagonal is column-wise
  162. matrix multiplication
  163.  
  164. Done
  165.